VISIBILITY LEVEL OF INHeRITANCE

Inheritance Visibility Mode:

Depending on Access modifier used while inheritance, the availability of class members of Super class in the sub class changes. It can either be private, protected or public.

1) Public Inheritance

This is the most used inheritance mode. In this the protected member of super class becomes protected members of sub class and public becomes public.

class Subclass : public Superclass

2) Private Inheritance

In private mode, the protected and public members of super class become private members of derived class.

class Subclass : Superclass   // By default its private inheritance
 

3) Protected Inheritance

In protected mode, the public and protected members of Super class becomes protected members of Sub class.

class subclass : protected Superclass

.

 

 

Inheritance and its types - by Mrs.M.Sharmila and Mrs.R.Jaya Bharathi